#include "createnewgroupparser.h"
#include "event/createnewgroupevent.h"
#include "common/defines.h"
#include <json.h>


#include <QVariantList>
#include <QVariant>
#include <QList>
#include <QDebug>

CreateNewGroupParser::CreateNewGroupParser(QObject *parent) :
    AbstractParser(parent)
{
}


AbstractParser::Type CreateNewGroupParser::type() const
{
    return AbstractParser::CreateGroupType;
}


AbstractEvent *CreateNewGroupParser::parse(const QString &commandId, const QVariant &data)
{
    int cmId = commandId.toInt();
    switch (cmId) {
    case CREATE_NEW_CHAT_CHANEL:
        return parseData(data);

    default:
        return NULL;
    }
}


AbstractEvent *CreateNewGroupParser::parseData(const QVariant &data)
{
    qDebug() << "AbstractEvent *CreateNewGroupParser::parseData"<< data;
    if (data.type() != QVariant::Map)
        return NULL;

    return new CreateNewGroupEvent(data);
}
